package com.dg11185.nearshop.activity.welcome;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewStub;
import android.widget.Button;
import android.widget.GridView;

import com.android.nearshop.R;
import com.dg11185.libs.network.NetClient;
import com.dg11185.libs.utils.file.FileUtils;
import com.dg11185.libs.utils.print.PrintUtils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.app.ViewUtils;
import com.dg11185.nearshop.net.CacheConstant;
import com.dg11185.nearshop.net.NetCacheClient;
import com.dg11185.nearshop.net.request.GetActivityListRequest;
import com.dg11185.nearshop.net.request.CountByAreaRequest;
import com.dg11185.nearshop.net.request.MyActivityRecordListRequest;
import com.dg11185.nearshop.net.response.GetActivityListResponse;
import com.dg11185.nearshop.net.response.CountByAreaResponse;
import com.dg11185.nearshop.net.response.MyActivityRecordListResponse;
import com.dg11185.nearshop.net.response.NetStatus;

public class TestActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         setContentView(R.layout.test_fragment_1);
         initNewActysView();
    }

    public void initMyActivity(){
        MyActivityRecordListRequest request = new MyActivityRecordListRequest("1").encryption();
        PrintUtils.printm(request.getParams());
        request.setActionListener(new MyActivityRecordListRequest.ActionListener<MyActivityRecordListResponse>(){

            @Override
            public void onSuccess(MyActivityRecordListResponse result) {
                PrintUtils.printc(result.records);
            }

            @Override
            public void onFailure(int resultCode) {
            }});
        NetCacheClient.httpGet(request);
    }
    // 初始化活动部分view
    public void initNewActysView() {

        GetActivityListRequest request = new GetActivityListRequest(Constants.AREA_NUM).encryption();
        request.setActionListener(new GetActivityListRequest.ActionListener<GetActivityListResponse>() {

            @Override
            public void onSuccess(GetActivityListResponse result) {
                if (result.status == NetStatus.SUCCESS) {
                    PrintUtils.printc(result.activities);
                } else {
                    onFailure(-1);
                }
            }

            @Override
            public void onFailure(int resultCode) {
            }
        });
        NetCacheClient.httpGet(request);
    }
}
